#include <cctype>
#include <string>
using namespace std;

bool isPalindrome(string s) {
  string s1;
  for (char c : s) {
    if (isalpha(c)) {
      s1 += tolower(c);
    }
    if (isdigit(c)) {
      s1 += tolower(c);
    }
  }
  string s2(s1.rbegin(), s1.rend());
  for (int i = 0; i < s1.size(); ++i) {
    if (s1[i] != s2[i])
      return false;
  }
  return true;
}